package io.xxx.omni.mdc.site.web

import io.xxx.omni.mdc.model.Platform
import io.xxx.omni.mdc.site.service.PlatformService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.cache.annotation.CacheConfig
import org.springframework.web.bind.annotation.*

@CacheConfig(cacheNames = ["platforms"])
@RestController
@RequestMapping("/platforms")
class PlatformController {

    @Autowired
    private lateinit var platformService: PlatformService

    @GetMapping
    fun getAll(@RequestParam enabled: Boolean?): List<Platform> {
        return platformService.getAll(enabled)
    }

    @GetMapping("/{id}")
    fun getOne(@PathVariable id: String): Platform? {
        return platformService.getOne(id)
    }
}